package ${package};

import com.ishansong.log.Loggers;
import org.slf4j.Logger;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 
 */
public class Server {

	private static ClassPathXmlApplicationContext context;
	private static final Logger log = Loggers.get(Server.class);

	/**
	 * 启动服务
	 * @throws InterruptedException
	 */
	public void run() throws InterruptedException {

		Runtime.getRuntime().addShutdownHook(new Thread() {

			// add hook here

		});

		context = new ClassPathXmlApplicationContext(new String[] { "classpath:application-service.xml" ,"classpath:application-context.xml"});
		context.start();

		log.info("${appName} Server Start Ok!");
		while (true) {
			Thread.sleep(Long.MAX_VALUE);
		}
	}

	public static void main(String[] args) throws Exception {

	 	Server server = new Server();
		try {
			server.run();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

		System.out.print("${appName} Server Start!");
	}

}
